package edu.gdkm.demo6.demo4;


import edu.gdkm.demo6.demo3.RemoteController;

public class Car implements RemoteController {
    private boolean power;
    private int volumn;

    public boolean isPower() {
        return power;
    }

    public void setPower(boolean power) {
        this.power = power;
    }

    public int getVolumn() {
        return volumn;
    }

    public void setVolumn(int volumn) {
        this.volumn = volumn;
    }

    public Car() {
        this.power =  false;
        this.volumn = DEFAULT_VOLUMN;
    }

    public Car(boolean power, int volumn) {
        this.power = power;
        this.volumn = volumn;
    }

    @Override
    public void powerOnOff() {
       this.power = !this.power;
       if(this.power){
           volumn=10;
       }else{
           volumn=0;
       }
    }

    @Override
    public void volumnUp(int increment) {

        volumn = volumn + increment;

    }

    @Override
    public void volumnDown(int increment) {
        volumn = volumn - increment;
    }

    @Override
    public String toString() {
        return "Car{" +
                "power=" + power +
                ", volumn=" + volumn +
                '}';
    }

    @Override
    public void outPut() {
        System.out.print("遥控汽车状态："+power);
        System.out.println(",当前速度是："+volumn);
    }
}
